<template>
  <div>
    <a-card style="position: relative">

      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="8">
              <a-form-item label="审计单位">
                <j-select-depart v-model="queryParam.departId" :trigger-change="true" customReturnField="id"
                                 :multi="true"></j-select-depart>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">清除条件</a-button>
            </span>
            </a-col>
          </a-row>
        </a-form>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
      <span slot="actionName">
        <a-button size="small" @click="handleAdd('添加单位')" type="primary" icon="plus">添加单位</a-button>
      </span>
        <span slot="action" slot-scope="text, record">
        <a @click="handleEdit(record,'单位编辑')">编辑</a>
        <a-divider type="vertical"/>
        <a @click="handlePerssion(record)">配置</a>
        <a-divider type="vertical"/>
        <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
          <a>删除</a>
        </a-popconfirm>
      </span>
      </a-table>
      <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
      <templateTree ref="templateTree" @ok="modalFormOk"></templateTree>
    </a-card>
  </div>
</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import CheckAndEditModel from './CheckAndEditModel'
  import templateTree from "./templateTree";
  import columns from './indexColumns'

  export default {
    name: "ssfamb",
    components: {
      CheckAndEditModel,
      templateTree
    },
    mixins: [JeecgListMixin],
    data() {
      return {
        //表头
        queryParam: {},
        columns: columns(this),
        url: {
          list: '/xtsz/sjImplementTemplate/queryImplementTemplateList',
          delete: '/xtsz/sjImplementTemplate/remove'
        }
      }
    },
    methods: {
      handlePerssion(record) {
        this.$refs.templateTree.show(record);
      },
    }
  }
</script>

<style scoped>

</style>